package com.sixkey.controller;

import com.sixkey.exception.BusinessException;
import com.sixkey.model.entity.User;
import com.sixkey.model.response.ResponseInfo;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * ClassName: TestController
 * Package: com.sixkey.controller
 * Description:
 *
 * @Author: @WeiXueShi
 * @Create: 2023/8/15 - 20:22
 * @Version: v1.0
 */

@Validated
@RestController
public class TestController {

    @GetMapping("/test")
    public ResponseInfo test(){
        if( 1 == 1){
            throw new BusinessException("业务异常");
        }
        return ResponseInfo.success();
    }

    @GetMapping("/get")
    public ResponseInfo getUser(@Valid User user){
        return ResponseInfo.success(user);
    }
}
